// Created by liusc on 2020/8/5-9:24.
<template>
  <div class="budgetWrap">
    <div class="resource-manage">
      <div class="card-box">
        <div class="card-title">
          <span>申请信息</span>
        </div>
        <el-form ref="add-form" :model="form" :rules="rules" class="form-wrap" label-width="auto">
          <el-row>
            <el-col :span="8">
              <el-form-item label="预算编号" prop="budgetCode">
                <el-col class="in_txt">{{form.applyData.budgetCode }}</el-col>
              </el-form-item>
            </el-col>
            <el-col :span="16">
              <el-form-item label="申请名称" prop="applyData.applyName">
                <el-input v-model="form.applyData.applyName" placeholder="请输入申请名称" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="申请部门">
                <el-col class="in_txt">{{ applyDept2 }}</el-col>
              </el-form-item>
            </el-col>
            <el-col :span="16">
              <el-form-item label="申请类型">
                <el-col class="in_txt">{{ applyType2 }}</el-col>
              </el-form-item>
            </el-col>
          </el-row>
          <div class="card-title">
            <span>预算申报</span>
          </div>
          <el-table
            :data="form.itemValueList"
            class="dubgetTable mt20"
            row-key="itemId"
            default-expand-all
            :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
          >
            <el-table-column class="weight" header-align="center" prop="itemName" label="科目名称" width="300">
              <template slot-scope="scope">
                <span style="margin-left: 10px">{{ scope.row.itemName }}</span>
                <el-switch
                  v-model="scope.row.isNead"
                  v-if="scope.row.children == null"
                  :width="28"
                  active-value="1"
                  inactive-value="0"
                  @change="handleSimpleIsNeadChange($event, scope.row)"
                />
              </template>
            </el-table-column>
            <el-table-column align="center" label="预算总金额(元)">
              <el-table-column align="center" prop="itemValue" :label="`${form.applyData.budgetSum}`">
                <template slot-scope="scope">
                  <el-input
                    maxlength="15"
                    v-model="scope.row.itemValue"
                    clearable
                    v-only-number="{min:0,precision:2}"
                    :disabled="scope.row.children !== null || scope.row.isNead == 0"
                    @input="simpleBudgetChange()"
                  />
                </template>
              </el-table-column>
            </el-table-column>
          </el-table>

          <el-form-item class="mt20" label="费用说明" prop="applyData.remarks">
            <el-input v-model="form.applyData.remarks" placeholder="请输入费用说明" />
          </el-form-item>
        </el-form>
      </div>
    </div>
    <!-- 上传附件部分=============================== -->
    <fileUpload ref="fileUpload" type="edit" :busId="fileId" :fileId="fileId2" @onSuccess="handleCompleted" />

    <!-- 取消保存部分============================== -->
    <div slot="footer" class="footer" style="padding-right: 0px">
      <el-button type="primary" v-throttle="[addCommit]">保 存</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </div>
</template>

<script src="./apply_add.js"></script>
<style lang="scss" scoped>
@import "./apply_add";
</style>
